home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util4 / 0utils.lha / 0Utils / ScriptName.data < prev    next >
Text File  |  1995-08-19  |  2KB  |  100 lines

  1.  
  2. #ifdef TPLTER
  3.  
  4. ScriptName = {
  5.  
  6.     SHORT = {{ output the (temp) name of the current script }};
  7.  
  8.     DESCRIPTION = {{
  9.     ScriptName just tries to output the contents of
  10.     process->cli->commandfile. this value is defined only,
  11.     if:
  12.         1) the command was called from inside a script, AND
  13.         2) the script had to be buffered in "T:Command-??-???"
  14.            this is, e.g. if the script contained a ".KEY"
  15.            directive or was read from an interactive device.
  16.  
  17.      RESULT
  18.     "T:Command-xx-Tyy" if possible.
  19.     }};
  20.  
  21.     BUGS = {{
  22.     If not run from within a script produces error
  23.     ERROR_OBJECT_WRONG_TYPE (I found no better error)
  24.     }};
  25.  
  26.     EXAMPLES = {{
  27.     >ScriptName
  28.     "ScriptName: object is not of required type"
  29.         (Was: "* Not in a Script *")
  30.  
  31.     >echo "scriptname" | srun execute in:
  32.     "T:Command-00-T04"
  33.     }};
  34.  
  35.     BUGS = {{
  36.     The result is most likely something like
  37.     'T:Command-??-T??' with ? being numbers,
  38.     if the system 'decided' to create a tempfile;
  39.     Up to now we can not get another result,
  40.     for if no tempfile is created, we get an
  41.     empty string =8-(.
  42.     }};
  43.  
  44.     HISTORY = {{
  45.     16-02-95 b_noll created
  46.     20-02-95 b_noll restructured source
  47.     21-02-95 b_noll added version/format-prefix/offset
  48.     27-02-95 b_noll replace BSTR extraction by FPrintf %b
  49.     20-03-95 b_noll added args diagnostics
  50.     19-08-95 b_noll created .data file
  51.     }};
  52.  
  53.  
  54. //    Template = ",";
  55. //    Arguments = {{
  56. //      int dummy;
  57. //    }};
  58.  
  59.     version = "1.2";
  60.  
  61.     body = {{
  62.         //struct Process          *pr;
  63.         struct CommandLineInterface *cli;
  64.         //pr = (struct Process *)FindTask(NULL);
  65.  
  66.         if (cli = Cli()) {
  67.  
  68.         if (cli->cli_Interactive) {
  69.             retval = RETURN_ERROR;
  70.             SetIoErr(ERROR_OBJECT_WRONG_TYPE);
  71.             //PutStr ("* Not in a Script *\n");
  72.         } else if (cli->cli_CommandFile) {
  73.             //from = BADDR(cli->cli_CommandFile);
  74.  
  75.     /* Bah! this is in fact a _PSEUDO_ BSTR: 'len' is totally undefined */
  76.  
  77.             //// this would be: get BSTR
  78.             //while (len--)
  79.             //      if (!(buffer[len] = from[len]))
  80.             //          buffer[len] = '\0';
  81.  
  82.             retval = RETURN_OK;
  83.  
  84.             FPrintf(Output(), "%b\n", cli->cli_CommandFile);
  85.         } else {
  86.             retval = RETURN_WARN;
  87.             //PutStr ("* No ScriptName *\n");
  88.             SetIoErr(ERROR_OBJECT_NOT_FOUND);
  89.         } /* if */
  90.         } else {
  91.         SetIoErr(ERROR_OBJECT_WRONG_TYPE);
  92.         } /* if */
  93.  
  94.     }};
  95.  
  96. };
  97.  
  98. #endif
  99.  
  100.